#ifndef __BOOT_PARAM_H
#define __BOOT_PARAM_H

union boot_params {
	/*
	 * Save registers. Later's code use these register value to:
	 * 1. Get parameters from previous boot stage
	 *
	 * For SPL:
	 *      a0 is boot param
	 * For U-Boot:
	 *      a0 is hartid from opensbi
	 *      a1 is opensbi param
	 *      a2 is opensbi param
	 *      a3 is boot param from SPL
	 */
	unsigned long regs[22];
	struct {
		unsigned long a[8];  /* a0 ~ a7 */
		unsigned long s[12]; /* s0 ~ s11 */
		unsigned long sp;
		unsigned long ra;
	} r;
};

enum boot_device {
	BD_NONE,
	BD_PFLASH,
	BD_SDMC0,
	BD_SDMC1,
	BD_SPINOR,
	BD_UART,
	BD_BOOTROM
};

#define set_boot_device(var, device)	\
	{									\
		(var) &= ~(0xF);				\
		(var) |= (device) & (0xF);		\
	}

#define get_boot_device(var)			((var)  &  0xF)



enum boot_device ap_get_boot_device(void);

#endif // !__BOOT_PARAM_H

